<?php defined('_JEXEC') or die('Restricted access');
$link_menu = JRoute::_( 'index.php?option=com_ohlasky' );
?>
<table>
    <tr>
        <td>
            <a href="<?php echo $link_menu; ?>">Hlavní menu ohlášek </a>
        </td>

    </tr>

</table>
<form action="index.php" method="post" name="adminForm">
    <div id="editcell">
        <table class="adminlist">
            <thead>
                <tr>
                    <th width="5">
                        <?php echo JText::_( 'ID' ); ?>
                    </th>
                    <th width="20">
                        <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
                    </th>
                    <th>
                        <?php echo JText::_( 'Název' ); ?>
                    </th>

                </tr>
            </thead>
            <?php
            $pocet_zaznamu_int = count( $this->items );
            $k = 0;
            for ($i=0, $n=count( $this->items ); $i < $n; $i++)	{
                $row = &$this->items[$i];
                $checked = JHTML::_('grid.id',   $i, $row->id );
                //$link = JRoute::_( 'index.php?option=com_ohlasky&controller=ohlasky&task=edit&cid[]='. $row->id );
                $link = JRoute::_( 'index.php?option=com_ohlasky&view=udalosti_sablony&sablona_id='. $row->id );
                ?>
            <tr class="<?php echo "row$k"; ?>">
                <td>
                    <?php echo $row->id; ?>
                </td>
                <td>
                    <?php echo $checked; ?>
                </td>
                <td>
                    <a href="<?php echo $link; ?>"><?php echo $row->nazev; ?></a>
                </td>

            </tr>
            <?php
            $k = 1 - $k;
        }

        ?>
        </table>
    </div>

    <input type="hidden" name="option" value="com_ohlasky" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="boxchecked" value="0" />
    <input type="hidden" name="controller" value="sablony" />
</form>

<?php
if (empty($pocet_zaznamu_int)) {
    echo '<h3>V databázi není uložena žádná šablona!</h3>';
    echo '<p>Šablonu vytvoříte kliknutím na zelené tlačítko s bílým "+" vpravo nahoře.</p>';
}
$link_hl_menu = JRoute::_( 'index.php?option=com_ohlasky' );
?>
<br />
<br />
<table class="adminlist">
    <tr>
        <td>
            <a href="<?php echo $link_hl_menu; ?>"> <?php echo JHTML::_('image.administrator', 'hlavni_menu.png','/components/com_ohlasky/images/'); ?></a>
        </td>
    </tr>

</table>
